#include<iostream>
#include<set>
using namespace std;
struct People{
	int h;
	int w;
	int age;
	People(int _h,int _w,int _age){
		h=_h;
		w=_w;
		age=_age;
	}
	bool operator <(const People &rsh) const{
		if(h!=rsh.h){
			return h<rsh.h;
		}
		if(w!=rsh.w){
			return w<rsh.w;
		}
		return age<rsh.age;
	}
};
set<People> s;
int main(){
	int n,m,h,w,age;
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> h >> w >> age;
		s.insert(People(h,w,age));
	}
	for(int i=0;i<m;i++){
		cin >> h >> w >> age;
		if(s.count(People(h,w,age))){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	return 0;
}
